package cn.stylefeng.guns.modular.entity.responseVo;

import cn.stylefeng.guns.modular.entity.Feedback;
import cn.stylefeng.guns.modular.entity.FeedbackClass;
import cn.stylefeng.guns.modular.entity.User;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Setter
@Getter
public class FeedbackListResponseVo {

    private Long id;

    private String content;

    private Long classId;

    private String className;

    private String userName;

    private String phone;

    private Date createdAt;

    private String status;

    private Date updatedAt;


    public static FeedbackListResponseVo fromFeedbackListResponseVo(Feedback feedback, User user, FeedbackClass feedbackClass) {
        FeedbackListResponseVo responseVo = new FeedbackListResponseVo();
        responseVo.setClassId(feedback.getClassId());
        responseVo.setClassName(feedbackClass.getClassName());
        responseVo.setContent(feedback.getContent());
        responseVo.setCreatedAt(feedback.getCreatedAt());
        responseVo.setPhone(user.getLogonId());
        responseVo.setStatus(getStatus(feedback.getHandleStatus()));
        responseVo.setUpdatedAt(feedback.getUpdatedAt());
        responseVo.setId(feedback.getId());
        responseVo.setUserName(user.getUserName());
        return responseVo;
    }

    public static String getStatus(Integer statsu) {
        String statusName = "";
        if (statsu == 1) {
            statusName = "未审核";
        }
        if (statsu == 2) {
            statusName = "已采纳";
        }
        if (statsu == 3) {
            statusName = "未采纳";
        }
        return statusName;
    }
}
